import Cookies from 'js-cookie';

const user = {
    state: {},
    mutations: {
        logout (state, vm) {
            Cookies.remove(`area_cloud_user`);
            // Cookies.remove('cloud_password');
            Cookies.remove('area_cloud_access');
            Cookies.remove('area_user_role_tag');
            // 恢复默认样式
            let themeLink = document.querySelector('link[name="theme"]');
            themeLink.setAttribute('href', '');
            // 清空打开的页面等数据，但是保存主题数据
            let areaTheme = '';
            if (localStorage.areaTheme) {
                areaTheme = localStorage.areaTheme;
            }
            // localStorage.clear();
            // sessionStorage.clear();
            if (areaTheme) {
                localStorage.areaTheme = areaTheme;
            }
        }
    }
};

export default user;
